var layer = layui.layer;
function Ajax(url,type="get",data=[],success,error){
    $.ajax({
        url: url,
        type: type,
        data: data,
        success: function (info) {
            if(info.code==3){
                layer.msg(info.msg,function(){
                    window.location.href = info.url;
                })
            }
            if(Object.prototype.toString.call(success)=="[object Function]" ){
                success(info)
            }else{
                console.log(info)
            }
        },
        error:function(e){
            if(Object.prototype.toString.call(error)=="[object Function]" ){
                error(e)
            }
            console.log(e,11)
        }
    });
}